﻿@model Mvc4Learn.Models.TestModels
@{
    ViewBag.Title = "测试页面";
}
<hgroup class="title">
    <h1>@ViewBag.Title.</h1>
    <h2>@ViewBag.Message</h2>
</hgroup>

@Html.TextArea("taText", "Hello <br /> World!")
<br />
@using (Html.BeginForm())
{
 
    <div>
        @* 测试label的for属性 *@
        @Html.LabelFor(x => x.IsTrue)
        @Html.CheckBoxFor(x => x.IsTrue);
    </div>
    <div>
        @Html.LabelFor(x => x.Name):
        @Html.TextBoxFor(x => x.Name)
        @Html.ValidationMessageFor(x => x.Name)

        <br />
        @Html.LabelFor(x => x.Money)：
        @*        @Html.TextBoxFor(x => x.Money)*@
        @* 寻找的顺序一直是先是ViewBag，再是Model，这里如果要显示Model中的内容
        就应该强制绑定。 *@
        @Html.TextBox("Money", Model.Money);
        @Html.TextBox("Models.Money")
        @Html.ValidationMessageFor(x => x.Money)

        <br />
        @Html.LabelFor(x => x.TestType)
        @Html.RadioButtonFor(x => x.TestType, 1, Model.TestType == 1 ? new { ischecked = true } : null)第一类型
        @Html.RadioButtonFor(x => x.TestType, 2, Model.TestType == 2 ? new { ischecked = true } : null)第二类型
        @Html.RadioButtonFor(x => x.TestType, 3, Model.TestType == 1 ? new { ischecked = true } : null)第三类型
    </div>
    <input type="submit" value="提交" />
    @Html.ActionLink("测试", "Test", new RouteValueDictionary { { "id", 3 } })
    @Url.Action("Test", new RouteValueDictionary { { "info", "ttt" } })
    <img src="@Url.Content("~/Images/mylogo." + "png")" alt="my logo" />
    
@* 到了mvc4，可以直接使用~了，这真是一个喜讯。 *@
    <img src="~/Images/mylogo.png" alt="my logo" />

@* Action方法类似RenderPartial *@
    @Html.Action("Menu", new { str1 = "tsfd", str2 = "gqqtest" })

    List<string> lst = new List<string> {"ttt", "eee"};
    @Html.Partial("Menu", lst)
    Html.RenderPartial("Menu", lst);
}